

from django.template import Library
from django.urls import reverse

register = Library()


@register.simple_tag(name="tag")
def revers_url(request):
    if request.path == reverse('customers'):
        return '公户信息'
    else:
        return '我的客户信息'


@register.simple_tag
def resole_url(request, url_name, customer_pk):
    next_url = request.get_full_path()
    reverse_url = reverse(url_name, args=(customer_pk, ))
    print('next_url', next_url)
    print(reverse_url)
    full_url =  reverse_url + '?next=' + next_url
    print(full_url)
    return full_url